package com.qf.smartdevice.utils;

import com.qf.smartdevice.pojo.SysUserInfo;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 王博康
 * @version 1.0
 * @project devicemanagementsystem
 * @description: TODO
 * @date 2022/3/21 22:36 星期一
 */
public class LoginUserInfoUtil {

    public static SysUserInfo getLoginUser(){

        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
        SysUserInfo userInfo = (SysUserInfo)request.getSession().getAttribute("user");
        return userInfo;
    }

}
